﻿using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
using System.Windows.Media;

using Xc.DataAccess.AepCoapCore.Models;

namespace Xc.Logics.AepCoap.Models
{
    public class DeviceStateConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is DeviceInfoList deviceInfoList)
            {
                switch (deviceInfoList.DeviceStatus)
                {
                    case 0:
                        return Brushes.Green;
                    case 1:
                        return Brushes.Blue;
                    case 2:
                        return Brushes.Red;
                    default:
                        break;
                }
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
